<template>
	<view class="agreement-window" @touchmove.stop.prevent>
		<view class="agreement-content" v-if="status">
			<view class="title-view">用户协议和隐私政策</view>
			<view class="text-one">
				感谢您信任并使用云诺小助手，我们依据最新的法律要求，更新了平台的《用户协议》和《隐私政策》，特意向您推送本提示，请您仔细阅读并充分理解相关条款。您点击“同意”即表示，您已阅读并同意更新后的协议和政策条款，我们将尽全力保障您的合法权益并为您提供更优质的产品和服务。
			</view>
			<navigator url="/pages/agreement/agreement?status=userSgreement" hover-class="none" class="cell-view">
				<view class="cell-content">
					<view class="label-view">《用户协议》</view>
					<view class="row">
						<view style="margin-right: 14upx;">查看</view>
						<uni-icons type="right" size="20upx" color="#97AFC9"></uni-icons>
					</view>
				</view>
			</navigator>
			<navigator url="/pages/agreement/agreement?status=privacyPolicy" hover-class="none" class="cell-view">
				<view class="cell-content" style="border-bottom: 1px solid #EEEEEE;">
					<view class="label-view">《隐私政策》</view>
					<view class="row">
						<view style="margin-right: 14upx;">查看</view>
						<uni-icons type="right" size="20upx" color="#97AFC9"></uni-icons>
					</view>
				</view>
			</navigator>

			<view class="button-view">
				<view class="button-item" @click="statusEvent(false)">不同意</view>
				<view class="button-item button-active" @click="agreeEvent">同意</view>
			</view>
		</view>

		<view v-else class="agreement-content" style="padding-top: 40upx;">
			<view class="text-one" style="padding: 0 60upx;">
				十分抱歉，若您不同意平台的《用户协议》和《隐私政策》，我们将无法为您提供服务
			</view>
			<view class="button-view">
				<view class="button-item" @click="dropOutEvent">继续退出</view>
				<view class="button-item button-active" @click="statusEvent(true)">暂不退出</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "AgreementWindow",
		data() {
			return {
				status: true
			};
		},
		beforeMount() {
			uni.hideTabBar()
		},
		methods: {
			/**
			 * 同意协议事件
			 */
			agreeEvent() {
				uni.showTabBar()
				uni.setStorageSync("agreement", 1)
				this.$emit("change", 1)
			},
			/**
			 * 退出系统
			 */
			dropOutEvent() {
				// #ifdef APP-PLUS  
				plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
				// #endif
			},
			statusEvent(event) {
				this.status = event
			},
		}
	}
</script>

<style scoped lang="scss">
	.agreement-window {
		width: 100%;
		height: 100vh;
		background: rgba(0, 1, 67, 0.9);
		position: fixed;
		left: 0;
		top: 0;
		z-index: 99999;
		@extend .column;

		.agreement-content {
			width: 580rpx;
			background: #FFFFFF;
			border-radius: 14rpx;
			padding-top: 26upx;

			.title-view {
				width: 100%;
				text-align: center;
				font-size: 33rpx;
				font-weight: 600;
				color: #282726;
			}

			.text-one {
				width: 100%;
				padding: 0 36upx;
				font-size: 27rpx;
				font-weight: 400;
				color: #282726;
				margin-top: 32upx;
				margin-bottom: 27upx;
			}

			.cell-view { 
				width: 100%;
				padding: 0 36upx;

				.cell-content {
					font-size: 27rpx;
					font-weight: 400;
					color: #FF2615;
					border-top: 1px solid #EEEEEE;
					padding: 22upx 0;
					@extend .row-between;

				}
			}

			.button-view {
				width: 100%;
				padding: 40upx 60upx;
				@extend .row-between;

				.button-item {
					width: calc(100% / 2 - 22upx);
					height: 70upx;
					background: #FFFFFF;
					border: 1px solid #FF2615;
					border-radius: 35upx;
					font-size: 30upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FF2615;
					@extend .row;
				}

				.button-active {
					border: none;
					background: linear-gradient(180deg, #FF7065 0%, #FF2615 100%);
					color: #FF2615;
				}
			}
		}
	}
</style>